import React from 'react'
import { HashRouter as Router, Switch, Route } from "react-router-dom"
import { isTemplateExpression } from 'typescript';
import comInfo from "../components";


import usermenuModel from '../interface/usermenuModel';
interface Iprops {
    list: Array<usermenuModel>
}

export default function Router2({ list }: Iprops) {


    return (

        <Router>
            <Switch>
                <Route path="/main" component={comInfo[list[0]?.component as string]} exact></Route>
                {list.map(item => {
                    return (<Route path={item.path} component={comInfo[item.component as string]} key={item._id}></Route>)
                })}
            </Switch>
        </Router>
    )
}
